package com.mop.springcloud.corebase.bean;

import java.lang.management.ManagementFactory;

/**
 * Class Name: AppRegister
 * Create Date: 18-3-15 下午1:21
 * Creator: Chim·Zigui
 * Version: v1.0
 * Updater:
 * Date Time:
 * Description:
 */
public class ServiceInfo {

    private static Long beginTime = null;
    private static Long starterDuration = null;                                // 启动耗时
    private static Long endTime = null;
    private static String javaRuntime = null;
    private static String applicationName;
    private static String serverPort;

    private Boolean shutdownListenerRegistered = false;                 // 是否注册了服务停止监听器
    private Boolean registerNotificationHook = false;                   // 是否注册了服务告警

    private static String serviceTag = null;
    private static Integer pid = null;

    static {
        serviceTag = System.getProperty("mop.springcloud.tag", "A");
        String name = ManagementFactory.getRuntimeMXBean().getName();
        pid = Integer.valueOf(name.split("@")[0]);
    }


    public Long getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Long beginTime) {
        this.beginTime = beginTime;
    }

    public Long getEndTime() {
        return endTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }

    public Boolean getShutdownListenerRegistered() {
        return shutdownListenerRegistered;
    }

    public void setShutdownListenerRegistered(Boolean shutdownListenerRegistered) {
        this.shutdownListenerRegistered = shutdownListenerRegistered;
    }

    public Boolean getRegisterNotificationHook() {
        return registerNotificationHook;
    }

    public void setRegisterNotificationHook(Boolean registerNotificationHook) {
        this.registerNotificationHook = registerNotificationHook;
    }

    public String getServiceTag() {
        return serviceTag;
    }

    public void setServiceTag(String serviceTag) {
        ServiceInfo.serviceTag = serviceTag;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        ServiceInfo.pid = pid;
    }

    public String getJavaRuntime() {
        return javaRuntime;
    }

    public void setJavaRuntime(String javaRuntime) {
        this.javaRuntime = javaRuntime;
    }

    public Long getStarterDuration() {
        return starterDuration;
    }

    public void setStarterDuration(Long starterDuration) {
        this.starterDuration = starterDuration;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setServerPort(String serverPort) {
        this.serverPort = serverPort;
    }

    public String getServerPort() {
        return serverPort;
    }
}
